﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

/// <summary>
/// Summary description for Globals
/// </summary>
public static class Globals
{
    static string ConnectionString;
    public static string ErrorString;

    public static string URL_VAR_ADDRESS_ID = "a";
    public static string URL_VAR_LOGIN_HASH = "c";

    public static string GetConnectionString()
    {
        if(string.IsNullOrEmpty( ConnectionString))
            ConnectionString = ConfigurationManager.ConnectionStrings["lettingsConnection"].ConnectionString;
        return ConnectionString;
    }

    public static string BuildAdminURLParams(HttpRequest request , string addressID)
    {
        string customerID = request["c"];
        if(customerID == null)
            return "?c=&a=";
        
        return "?c=" + customerID + "&a=" + addressID;
    }
}